from selenium import webdriver
# 导入显式等待
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait

driver = webdriver.Chrome()
driver.get("https://www.baidu.com")
# TODO 等待True 超时没有返回True,就抛出异常   EC.title.is
# result1 = WebDriverWait(driver, 10).until(EC.title_is('百度一下，你就知道'), message='标题不一致')
# print(result1)
# TODO 等待False 超时没有返回False,就抛出异常 EC.presence_of_element_located
result2 = WebDriverWait(driver, 10).until(EC.presence_of_element_located(((By.ID, "kw"))))
print(result2)

# * 拆包
t1 = (By.ID, "kw")
t2 = [By.ID, "KW"]
kw1 = driver.find_element(*t1)
print(kw1.get_attribute("outerHTML"))



driver.quit()